import sys
from numpy.numarray import array, dot, zeros, Float64
from numpy import hstack
from math import sqrt

t = sqrt(3)

shape_type = int(sys.stdin.readline())

n = int(sys.stdin.readline())
m = n+2
k = 0
if  shape_type == 1:  
    k = m*(2*n+ 1)
elif shape_type == 2:
    k = m*m
h = 1.0 / (n-1)
sk = 1.0 
st = 1/sqrt(3.0)
hk = sk / (n-1)
ht = st / (n-1)
htv = h/ t

x = zeros((2*k), type=Float64)
#f = open('tst-graph.txt', 'w')
#print >>f, 'Test build-graph'

for i in xrange(2*k):
	x[i] = float(sys.stdin.readline())
	#print >>f, x[i]
#f.close()

t1 = zeros((0))
for i in range(0, k):
    if (i>n+1) and (i%m <> 0) and (i%m <> n+1) and (i<k-n-1):
        t1 = hstack((t1, x[i]))


t2 = zeros((0))
for i in range(k, 2*k):
    if (i>k+n+1) and (i%m <> 0) and (i%m <> n+1) and (i<2*k-n-1):
        t2 = hstack((t2, x[i]))

print len(t1), ' ', len(t2)

from pylab import *
from numpy import ma
if shape_type == 1:
    X,Y = meshgrid( arange(0, sk+hk, hk), hstack((arange(sk+st, st-hk, -hk), arange(st-ht, -ht, -ht))) )
elif shape_type == 2:
    X,Y = meshgrid( arange(0, 1+h, h),arange(1, -h, -h) )
#X,Y = meshgrid( arange(0, 1+h, h),arange(1, -h, -h) )
U = t1
V = t2

figure()
Q = quiver( X, Y, U, V, color='r')
plot( X, Y, 'k.')
if shape_type == 1:
    axis([-hk, sk+hk, -2*hk, sk+st+hk])
elif shape_type == 2:
    axis([-hk, 1+hk, -hk, 1+hk])
title("pivot='mid'; every third arrow; units='inches'")

show()
